-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
Actually, |
neofetch
Outdated
if [[ "${BASH_VERSINFO[0]}" ]]; then | ||
bash_version=${BASH_VERSINFO[0]} | ||
else | ||
bash_version=5 | ||
shopt -s eval_unsafe_arith | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably easier to just do bash_version=${BASH_VERSINFO[0]:-5}
and then run the shopt with &>/dev/null
(always).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question, will it be difficult for us to remove the shopt entirely? What needs to be done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually haven't had any issues without it, but I noticed that you do an unset -v "gpus[0]"
on a certain condition in the script, which is invalid in OSH without eval_unsafe_arith
.
bash_version=${BASH_VERSINFO[0]:-5} | ||
shopt -s eval_unsafe_arith &>/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Fallback to a value of '5' for shells which support bash
# but do not set the 'BASH_' shell variables (osh).
bash_version=${BASH_VERSINFO[0]:-5}
shopt -s eval_unsafe_arith &>/dev/null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I actually set BASH_VERSION
later on. I could probably use shell+=$BASH_VERSION; shell=${shell/-*}
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, that doesn't make sense. At all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think what I was going for was:
if [[ $BASH_VERSION ]]; then
shell+=$("$SHELL" -c "printf %s \"\$BASH_VERSION\"")
else
shell+=$BASH_VERSION
fi
shell=${shell/-*}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or actually, something like:
shell+=${BASH_VERSION:-$("$SHELL" -c "printf %s \"\$BASH_VERSION\"")}
shell=${shell/-*}
But if you're fine with that, then cool
Not sure if it should use the current
$OIL_VERSION
if it exists and if$BASH_VERSION
should only be set if the$SHELL
isbash
.